# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=ospd-openvas
pkgver=1.0.1
pkgrel=5
pkgdesc="ospd-openvas is an OSP server implementation to allow GVM to remotely control an OpenVAS Scanner"
url="https://github.com/greenbone/ospd-openvas"
arch="noarch"
license="GPL-2.0"
pkgusers="gvm"
pkggroups="gvm"
depends="py3-psutil py3-redis py3-setuptools py3-packaging ospd"
subpackages="$pkgname-openrc"
source="$pkgname-$pkgver.tar.gz::https://github.com/greenbone/ospd-openvas/archive/v$pkgver.tar.gz
	$pkgname.initd
	$pkgname.confd
	ospd.conf"
build() {
	python3 setup.py build
}

check() {
	python3 setup.py check
}

package() {
	python3 setup.py install --root="$pkgdir" --optimize=1
	mkdir -p "$pkgdir"/run/ospd
	chown -R $pkgusers:$pkggroups "$pkgdir"/run/ospd
	install -Dm755 "$srcdir"/$pkgname.initd "$pkgdir"/etc/init.d/$pkgname
	install -Dm644 "$srcdir"/$pkgname.confd "$pkgdir"/etc/conf.d/$pkgname
	install -Dm644 "$srcdir"/ospd.conf "$pkgdir"/etc/openvas/ospd.conf
}

sha512sums="bdcdb1a8bc08fc27f1a85846ad944b3764a67c153cd75ffa607f69e0c07f223aa0e0965ee081e2398d4d47fc6faf1fd6fad90e6bc724952a0679de783dd2cc87  ospd-openvas-1.0.1.tar.gz
af576db115f85e80d7e2e8a91508c0ce70e911002ab97ccd4ebb089c487b515ca393ae9fd284ecc9d3f533a2ab4a741faa1dcc4f2047b7f1ca541832ce8b6b09  ospd-openvas.initd
ef07f02c3900ee431785b2c2e53f04f4fd114f502526ec509c869dcd3a95e4284fc65f05f5ec85280cc05a29a46fba9c74ef3b0b0d618b9c9c1e62d9bb3fc6fa  ospd-openvas.confd
cca4e7d9d0ed299e43d748337c8a848056c9125bb3fea32d42409f50852422cc8409388c7b5e275e3d4b78d6f86f11c64adddaa9e3dd622bbf9e09579f4ea3be  ospd.conf"
